package chap_02;

import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.List;

public class Run {
    @Test
    public void emo_01() {
        List<Apple> inventory = Arrays.asList(
                new Apple(80,"green"),
                new Apple(155, "green"),
                new Apple(120, "red")
        );

        List<Apple> apples = Filter.filterGreenApples(inventory, (Apple a) -> "green".equals(a.getColor()));
        System.out.println(apples);
    }

    @Test
    public void emo_02() {
        List<Apple> inventory = Arrays.asList(
                new Apple(80,"green"),
                new Apple(155, "green"),
                new Apple(120, "red")
        );

        List<Apple> apples = Filter.filterGreenApples(inventory, (Apple a) -> {
            return "green".equals(a.getColor()) && a.getWeight() > 150;
        });
        System.out.println(apples);
    }
}
